<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修复测试</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #1a1a1a;
            color: white;
        }
        #gameCanvas {
            border: 2px solid #333;
            background-color: #000;
        }
        .status {
            margin-top: 10px;
            padding: 10px;
            background-color: #2a2a2a;
            border-radius: 5px;
        }
    </style>
</head>
<body>
    <h1>修复测试</h1>
    <canvas id="gameCanvas" width="800" height="600"></canvas>
    <div class="status" id="status">正在初始化...</div>

    <!-- 游戏脚本 -->
    <script src="js/utils.js"></script>
    <script src="js/balanceConfig.js"></script>
    <script src="js/sprite.js"></script>
    <script src="js/pixelArt.js"></script>
    <script src="js/uiAssets.js"></script>
    <script src="js/soundGenerator.js"></script>
    <script src="js/performance.js"></script>
    <script src="js/player.js"></script>
    <script src="js/enemy.js"></script>
    <script src="js/weapon.js"></script>
    <script src="js/item.js"></script>
    <script src="js/clone.js"></script>
    <script src="js/minion.js"></script>
    <script src="js/ui.js"></script>
    <script src="js/game.js"></script>

    <script>
        let game;
        
        async function initTest() {
            const statusDiv = document.getElementById('status');
            
            try {
                statusDiv.textContent = '正在创建游戏实例...';
                game = new Game();
                
                statusDiv.textContent = '正在加载游戏资源...';
                await game.loadGameAssets();
                
                statusDiv.textContent = '正在初始化游戏...';
                await game.init();
                
                statusDiv.textContent = '游戏初始化完成！';
                
                // 开始简单的渲染循环
                renderLoop();
                
            } catch (error) {
                statusDiv.textContent = `错误: ${error.message}`;
                console.error('初始化失败:', error);
            }
        }
        
        function renderLoop() {
            const canvas = document.getElementById('gameCanvas');
            const ctx = canvas.getContext('2d');
            
            // 清空画布
            ctx.fillStyle = '#000000';
            ctx.fillRect(0, 0, canvas.width, canvas.height);
            
            // 渲染玩家
            if (game && game.player) {
                game.player.render(ctx);
            }
            
            requestAnimationFrame(renderLoop);
        }
        
        // 启动测试
        window.addEventListener('load', initTest);
    </script>
</body>
</html> 